package com.bdilab.iot.dto.userdto;

import com.bdilab.iot.consts.Constants;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Pattern;
import java.util.List;

/**
 * @author WangNing
 * @version 1.0
 * @date 2020/8/1 19:28
 */
@Data
@ApiModel
public class CreateUserDto {

    @NotBlank(message = "用户名不能为空")
    @ApiModelProperty(value = "用户名", required = true)
    private String name;

    @NotBlank(message = "密码不能为空")
    @Pattern(regexp = Constants.REG_USER_PASSWORD, message = "密码长度为6-20位")
    @ApiModelProperty(value = "密码", required = true)
    private String password;

    @ApiModelProperty(value = "电话号码", required = false)
    private String phoneNum;

    @Min(value = 1L, message = "项目ID不合法")
    @ApiModelProperty(value = "项目ID", required = true)
    private Long project;

    @ApiModelProperty(value = "关联角色", required = true)
    @NotEmpty(message = "用户绑定的角色不能为空")
    private List<Long> roles ;


}
